<?php
namespace Laoha\Blog\Transformers;
use Laoha\Blog\Models\LaohaBlog;
use Flugg\Responder\Transformers\Transformer;

class LaohaBlogTransformer extends Transformer
{
    /**
     * List of available relations.
     *
     * @var string[]
     */
    protected $relations = [
		'cate'
        //'cates' => CateTransformer::class,
		//'attaches',
        //'users',
    ];
    /**
     * List of autoloaded default relations.
     *
     * @var array
     */
    protected $load = [];
    /**
     * Transform the model.
     *
     * @param \Laoha\Blog\Models\LaohaBlog $blog
     * @return array
     */
    public function transform(LaohaBlog $blog)
    {
        return $blog->toArray();
    }
    /**
     * @param $blog
     * @return string
     
    public function includeAttaches($blog)
    {
        $attachesArray = $post->attaches->toArray();
        if ($attachesArray) {
            $key = array_search('attaches', array_column($attachesArray, 'app_id'));
            return $key ? [$attachesArray[$key]['file']] : [];
        } else {
            return [];
        }
    }*/
}